Introduction

Our problem domain analyzes audio features and music genres and answers the questions:

The purpose of the project is to explore the differences of audio features between genres and across different countries. Using data from the audio streaming platform, Spotify, we have created a bar chart, histogram, and map of how these differences can be visualized. The source of our data comes from the spotifyr package.

Summary

The dataset has 200907 observations and 18 variables. These variables are the columns of the datasets, and the column names are genre, artist_name, track_name, track_id, popularity, acousticness, danceability, duration_ms, energy, instrumentalness, key, liveness, loudness, mode, speechiness, tempo, time_signature, valence. This particlar project is interested in understanding the variance of different audio features across genres. Therefore, the different genres observed in the dataset are Opera, Alternative, Blues, Dance, Pop, Electronic, R&B, Children’s Music, Folk, Anime, Rap, Classical, Reggae, Hip-Hop, Country, Reggaeton, Ska, Indie, Rock, Soul, Jazz, World. Lastly, it is important to note that while the number of observations for the genres are similar, they are not equal. This is expressed in the table below.

Var1 Freq
Alternative 9353
Anime 9353
Blues 9353
Children’s Music 9353
Classical 9256
Country 8664
Dance 8701
Electronic 9377
Folk 9299
Hip-Hop 9295
Indie 9543
Jazz 9441
Opera 8280
Pop 9386
R&B 8992
Rap 9232
Reggae 8771
Reggaeton 8927
Rock 9272
Ska 8874
Soul 9089
World 9096

Table

The following table shows the average danceability, energy, valence, acousticness, and tempo based on music genre. The table is ordered by which genre has the highest average popularity ratings on a scale from 0-100. Pop music is highest on the charts. Ska music has the fastest average tempo. Reggae music has the highest average valence. Ska music has the highest average energy. Opera music is the most acoustic on average. Reggaeton music has the highest average danceability.

Interestingly, the table shows trends across genres such as when popularity of a genre decreases acousticness tends to increase. For example, opera and classical music are two of the least popular genres and have average acousticness of 0.95 and 0.87, respectively. In addition, reggaeton and reggae are not popular genres yet have the highest levels of danceability at 0.73 and 0.7, respectively.

Genre Average Danceability Average Energy Average Valence Average Acousticness Average Tempo Popularity Rating
Pop 0.64 0.64 0.48 0.22 121.18 67
Rap 0.70 0.65 0.46 0.17 121.10 61
Rock 0.54 0.68 0.52 0.20 122.63 60
Hip-Hop 0.72 0.64 0.47 0.18 120.79 58
Dance 0.64 0.70 0.52 0.15 120.80 57
Alternative 0.54 0.71 0.45 0.16 121.93 55
Anime 0.54 0.71 0.45 0.16 121.93 55
Blues 0.54 0.71 0.45 0.16 121.93 55
Children’s Music 0.54 0.71 0.45 0.16 121.93 55
Indie 0.57 0.58 0.43 0.33 119.29 55
R&B 0.64 0.56 0.45 0.29 116.37 52
Folk 0.53 0.49 0.44 0.46 118.75 50
Soul 0.62 0.53 0.48 0.36 115.32 47
Country 0.58 0.64 0.54 0.27 123.41 46
Jazz 0.59 0.47 0.51 0.50 111.78 41
Electronic 0.62 0.74 0.39 0.12 125.85 38
Reggaeton 0.73 0.75 0.66 0.22 120.99 38
Reggae 0.70 0.64 0.68 0.19 118.16 36
World 0.44 0.51 0.30 0.39 119.82 36
Classical 0.31 0.18 0.21 0.87 104.34 29
Ska 0.53 0.82 0.65 0.10 129.43 29
Opera 0.29 0.17 0.19 0.95 101.80 13

Charts

Bar Chart

The bar chart below attempts to express how the audio features of the chosen genres (designated in the summary information) vary from one another. In order to achieve this, the chart examines the audio feature of valence for comparison across the genres was valence. The average valence was taken for each genre (i.e. the average valence of 100 songs for each genre), and is displayed from greatest to least in the bar chart. Our intent for the final project is to be able to change the audio feature, from valence to another choice, based off user input.

Please note: Valence as described by the Spotify API is the postiveness of the song (0 - extremely negative; 1 - highly positive).

The information from the chart reveals that music categorized as “regge” has the highest valence and “opera” music has the lowest valence. As we look at the ordering of the valence scores, the placement of some genres is not completely surprising as our team can imagine the cultural characteristics associated with each genre. For example, operatic themes trend towards dishonor and suicide, unrequited love, death and pain, all accounting for the genre’s low valence score. On the other hand, the chart reveals surprising findings such as how reggae has the highest valence score. This is strange since reggae music boasts musical themes such as social criticism and diaspora feelings, which are arguably negative topics. However, this leads us into further investigation, as the Spotify API does not state how valence is measured it is possible that factors other than lyrics contribute to the score. Therefore, we hope to examine how other features like speechiness, tempo, danceability, etc. contribute to valence, as well as examine how audio features vary across genres.

Histogram

The histogram attempts to show what range a single feature of one genre is in. From this, we can learn the general trend of even the mean value of danceability feature in genre of opera. This is important to know since we can better understand the structure and trend of audio features across every genres only if we fully understand how a specific feature looks like in each genre.

As you can see in the histogram chart, most of the danceability of opera goes within the range of 0.2-0.3. Also, since it is a slightly right-skewed histogram, we can also learn that the mean is greater than the median of daceability in opera.

Map

The map attempts to visualize how the average valence of top 50 songs vary by country. In other words, how positive does each country in North America prefer their music? As you can see in the map, Central American countries prefer their music to be highly positive, while valence gets lower (i.e. music gets less positive) as you go futher North. For the final project, we intend to add more countries to this chart and allow the characteristic that is visualized (in this case, valence) to be selected by the user from a list of musical characteristics.

The chart is interactive; you can hover over each country to see its precise average valence score.